package biteHomework._11_01;
//调整数组顺序使得奇数位于偶数之前。调整之后，不关心大小顺序。
//如数组：[1,2,3,4,5,6]
//调整后可能是：[1, 5, 3, 4, 2, 6]
public class H_04 {
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5,6};
        arr = adjust(arr);
        for(int i : arr){
            System.out.print(i + " ");
        }
    }
    public static int[] adjust(int[] arr){
        int temp = 0;
        for (int i = 0; i < arr.length - 1; i++) {
            for (int j = 0; j < arr.length - i - 1; j++) {
                if(arr[j] % 2 == 0){
                    temp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = temp;
                }
            }
        }
        return arr;
    }
}
